package com.hzy.es.repository;

import com.hzy.es.entity.Item;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.Collection;
import java.util.List;

/**
 *
 */
public interface ItemRepository extends ElasticsearchRepository<Item,Long> {
    /** 可以自定义方法，无需实现，按照一定规则 */

    /**
     * 类型：And
     * 方法名: findByNameAndPrice
     * elasticsearch：{"bool" : {"must" : [ {"field" : {"name" : "?"}}, {"field" : {"price" : "?"}} ]}}
     */
    /**
     * 类型：Or
     * 方法名: findByNameOrPrice
     * elasticsearch：{"bool" : {"should" : [ {"field" : {"name" : "?"}}, {"field" : {"price" : "?"}} ]}}
     */
    /**
     * 类型： Is
     * 方法名: findByName
     * elasticsearch： {"bool" : {"must" : {"field" : {"name" : "?"}}}}
     */
    /**
     * 类型： Not
     * 方法名: findByNameNot
     * elasticsearch： {"bool" : {"must_not" : {"field" : {"name" : "?"}}}}
     */
    /**
     * 类型：Between
     * 方法名: findByPriceBetween
     * elasticsearch： {"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}
     */
    /**
     * 类型：LessThanEqual
     * 方法名: findByPriceLessThan
     * elasticsearch： {"bool" : {"must" : {"range" : {"price" : {"from" : null,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}
     */
    /**
     * 类型： GreaterThanEqual
     * 方法名: findByPriceGreaterThan
     * elasticsearch：{"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : null,"include_lower" : true,"include_upper" : true}}}}}
     */
    /**
     * 类型： Before
     * 方法名: findByPriceBefore
     * elasticsearch：{"bool" : {"must" : {"range" : {"price" : {"from" : null,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}
     */
    /**
     * 类型： After
     * 方法名: findByPriceAfter
     * elasticsearch：{"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : null,"include_lower" : true,"include_upper" : true}}}}}
     */
    /**
     * 类型： Like
     * 方法名: findByNameLike
     * elasticsearch：{"bool" : {"must" : {"field" : {"name" : {"query" : "?*","analyze_wildcard" : true}}}}}
     */
    /**
     * 类型： StartingWith
     * 方法名: findByNameStartingWith
     * elasticsearch：{"bool" : {"must" : {"field" : {"name" : {"query" : "?*","analyze_wildcard" : true}}}}}
     */
    /**
     * 类型： EndingWith
     * 方法名:
     * elasticsearch：{"bool" : {"must" : {"field" : {"name" : {"query" : "*?","analyze_wildcard" : true}}}}}
     */
    /**
     * 类型：Contains/Containing
     * 方法名: findByNameContaining
     * elasticsearch： {"bool" : {"must" : {"field" : {"name" : {"query" : "**?**","analyze_wildcard" : true}}}}}
     */
    /**
     * 类型： In
     * 方法名: findByNameIn
     * elasticsearch：{"bool" : {"must" : {"bool" : {"should" : [ {"field" : {"name" : "?"}}, {"field" : {"name" : "?"}} ]}}}}
     */
    /**
     * 类型：NotIn
     * 方法名: findByNameNotIn
     * elasticsearch：{"bool" : {"must_not" : {"bool" : {"should" : {"field" : {"name" : "?"}}}}}}
     */
    /**
     * 类型：Near
     * 方法名: findByStoreNear
     * elasticsearch： Not Supported Yet !
     */
    /**
     * 类型：True
     * 方法名: findByAvailableTrue
     * elasticsearch：{"bool" : {"must" : {"field" : {"available" : true}}}}
     */
    /**
     * 类型：False
     * 方法名: findByAvailableFalse
     * elasticsearch： {"bool" : {"must" : {"field" : {"available" : false}}}}
     */
    /**
     * 类型：OrderBy
     * 方法名: findByAvailableTrueOrderByNameDesc
     * elasticsearch：{"sort" : [{ "name" : {"order" : "desc"} }],"bool" : {"must" : {"field" : {"available" : true}}}}
     */
}

